<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="../vue.js"></script>
</head>
<style>
  *{
    margin: 0;
    padding: 0;
    list-style: none;
  }
  .box{
    width: 100%;
    height: 56px;
    text-align: center;
    color: #fff;
    margin-bottom: 20px;
  }
  .orange{
    background-color: orange;
  }
  .skyblue{
    background-color: skyblue;
  }
  .pink{
    background-color: pink;
  }
</style>
<body>
  <div id="app">
    <my-title  classes="orange" title="首页"></my-title>

    <my-title  classes="skyblue" title="列表"></my-title>
    
    <my-title  classes="pink" title="详情"></my-title>
  </div>
  <!-- 标题组件 -->
  <template id="title">

    <!-- //box 后面的引号必须空格 -->
    <div :class=" 'box '  + classes ">
      <h1> {{title}}</h1>
    </div>
  </template>


  <script>
    //组件
    const Title = {
      template:"#title",
      props:["title","classes"]
    }
      new Vue({
        el:'#app',
        //注册组件
        components:{
          "my-title":Title
        }
      })

  </script>
</body>
</html>